
<%@page import="lib_model.Cart.Cart"%>
<%@page import="lib_model.Account.Account"%>
<%@page import="java.util.ArrayList"%>
<%@page import="lib_model.Categories.Categories"%>
</head>
<body>
    <div class="container">
        <div id="header">
        </div>
        <ul id="topnav">
            <li>
                <a href="../pages/home.jsp" class="home">Home</a>
            </li>
            <li>
                <a href="#" class="products">Products</a>
                <div class="sub">
                    <% Categories cate = new Categories();
                        ArrayList<Categories> lcate = (ArrayList<Categories>) cate.Select().ObjResult;
                        int i = 0;
                        for (Categories cates : lcate) {
                    %>
                    <%  if (i % 10 == 0) {%>
                    <ul>
                        <li>
                            <h2><a href="#">Categories</a></h2>
                        </li>
                        <% }%>
                        <li>
                            <a href="../pages/categories.jsp?id=<%= cates.id%>"><%= cates.name%></a>
                        </li>
                        <%   i++;
                                if (i % 10 == 0) {%>
                    </ul>
                    <%}%>
                    <%  }%>
                    <ul>
                        <li>
                            <h2><a href="#">Other</a></h2>
                        </li>
                        <li>
                            <a href="#">Top Buy Product</a>
                            <a href="#">Top Like Product</a>
                            <a href="#">New Product</a>
                        </li>
                    </ul>
                </div>
            </li>
            <li>
                <a href="../pages/cart.jsp" class="cart">cart</a>
                <div class="sub">
                    <ul>
                        <% if (request.getSession().getAttribute("Cart") != null) {%> 
                        <li>
                            <h2><a href="../pages/cart.jsp">Cart</a></h2>
                        </li>
                        <li>
                            <a href="#">Total Price : <%= ((Cart) request.getSession().getAttribute("Cart")).TotalCart()%></a>
                        </li>
                        <%}%>

                    </ul>
                </div>
            </li>
            <li>
                <a href="#" class="account">Account</a>
                <div class="sub">
                    <div class="row">
                        <ul style="width: 225px;">
                            <% if (request.getSession().getAttribute("User") == null) {%>
                            <li>
                                <h2><a href="#">Account Information</a></h2>
                            </li>
                            <li>
                                <a href="../pages/login.jsp">Login</a>
                            </li>
                            <li>
                                <a href="../pages/forgot-password.jsp">Forgot Password</a>
                            </li>
                            <li>
                                <a href="../pages/register.jsp">Register</a>
                            </li>
                            <% } else {%>
                            <li>
                                Welcome <b><%= ((Account) request.getSession().getAttribute("User")).username%></b>
                            </li>
                            <% if (((Account) request.getSession().getAttribute("User")).group_id_ref == 1) {%>
                            <li>
                                <a href="../administrator/home.jsp">Manager Administrator</a>
                            </li>
                            <%} else if (((Account) request.getSession().getAttribute("User")).group_id_ref == 3) {%>
                            <li>
                                <a href="../factories/home.jsp">Manager Factory</a>
                            </li>
                            <%} else if (((Account) request.getSession().getAttribute("User")).group_id_ref == 4) {%>
                            <li>
                                <a href="../warehouses/bill.jsp">Manager Warehouse</a>
                            </li>
                            <%} else {%>
                            <%}%>
                            <li>
                                <a href="../pages/info.jsp">Information</a>
                            </li>
                            <li>
                                <a href="../pages/change-password.jsp">Change Password</a>
                            </li>
                            <li>
                                <a href="../auth/Logout">Logout</a>
                            </li>
                            <%}%>
                        </ul>

                    </div>
                </div>
            </li>
        </ul>
    </div>
    <div class="clear">
    </div>